package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class JDBCDemo2 {
    public static void main(String[] args) {
        try {
            Connection connection = DBUtil.getConnection();
            Statement statement = connection.createStatement();
            String sql = "INSERT INTO userinfo(" +
                    "username,password,nickname,age" +
                    ")VALUES (" +
                    "'王克晶','123456','克晶',18)";
            int num = statement.executeUpdate(sql);
            if(num>0){
                System.out.println("插入成功");
            }
            connection.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
